package com.yaozheng.vocationaltraining.dialog.paper;

import android.content.Context;
import android.view.Gravity;

import com.yaozheng.vocationaltraining.R;
import com.yaozheng.vocationaltraining.dialog.BaseDialog;
import com.yaozheng.vocationaltraining.fragment.BaseFragment;
import com.yaozheng.vocationaltraining.view.paper.CarryOutAnAssignmentAskView;
import com.yaozheng.vocationaltraining.view.paper.CarryOutAnAssignmentAskView_;

/**
 * 交卷对话框
 */
public class CarryOutAnAssignmentAskDialog extends BaseDialog {
    CarryOutAnAssignmentAskView carryOutAnAssignmentAskView;

    BaseFragment baseFragment;

    public CarryOutAnAssignmentAskDialog(Context context) {
        super(context, R.style.baseDialogStyleTheme, true, Gravity.CENTER);
    }

    public CarryOutAnAssignmentAskDialog(BaseFragment baseFragment) {
        this(baseFragment.getContext());
        this.baseFragment = baseFragment;
    }

    public CarryOutAnAssignmentAskDialog(Context context, int theme, boolean isCover, int gravity) {
        super(context, theme, isCover, gravity);
    }

    @Override
    public void setContentView() {
        carryOutAnAssignmentAskView = CarryOutAnAssignmentAskView_.build(getContext());
        carryOutAnAssignmentAskView.setBaseDialogEventProcess(this);
        setContentView(carryOutAnAssignmentAskView);
    }

    public void setContentValue(String value) {
        carryOutAnAssignmentAskView.setContentValue(value);
    }

    @Override
    public void initBaseDialog() {
        super.initBaseDialog();
        setCanceledOnTouchOutside(false);
    }

    /**
     * 确认
     */
    public void determine() {
        cancel();
        if (baseFragment != null) {
            baseFragment.runMethod("carryOutAnAssignmentAskDialogDetermine");
        } else {
            if (baseActivity != null) {
                baseActivity.runMethod("carryOutAnAssignmentAskDialogDetermine");
            }
        }
    }

    public void details() {
        cancel();
        if (baseFragment != null) {
            baseFragment.runMethod("detailsClick");
        } else {
            if (baseActivity != null) {
                baseActivity.runMethod("detailsClick");
            }
        }
    }
}
